using System;

namespace TaskFramework
{
    public abstract class Task
    {
        private static readonly object _lock = typeof(Task);
        private static int _taskCounter;
        protected readonly int _taskId;

        protected Task()
        {
            lock (_lock)
            {
                _taskId = ++_taskCounter;
            }
        }

        public abstract object RequestData { get; }
        
        public abstract void Execute(RoutingHelper router);

        public int TaskId
        {
            get { return _taskId; }
        }

        public override string ToString()
        {
            return "TaskId = " + _taskId;
        }
    }
}